import React from 'react';
import { routerRedux , Switch } from 'dva/router';
import { getRouterData } from './common/router';
import AuthorizedRoute from './components/Authorized/AuthorizedRoute';

const { ConnectedRouter } = routerRedux;

function RouterConfig({ history, app }) {
  const routerData = getRouterData(app);
  const BasicLayout = routerData['/'].component;
  return (
    <ConnectedRouter history={history}>
      <Switch>
        <AuthorizedRoute
          path="/"
          render={props => <BasicLayout {...props} />}
        />
      </Switch>
    </ConnectedRouter>
  );
}

export default RouterConfig;
